package com.bite.friend.Controller;

import com.bite.api.VO.UserQuestionResultVO;
import com.bite.friend.DTO.UserQuestionDTO;
import com.bite.friend.DTO.UserSubmitDTO;
import com.bite.friend.Service.UserSubmitService;
import domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/userQuestion")
public class UserQuestionController {

    @Autowired
    private UserSubmitService userQuestionService;

    //用户代码提交   请求方法  地址  参数  响应数据结构
    @PostMapping("/submit")
    public R<UserQuestionResultVO> submit(@RequestBody UserSubmitDTO submitDTO) {
        return userQuestionService.submit(submitDTO);
    }

    @PostMapping("/rabbit/submit")
    public R<Void> rabbitSubmit(@RequestBody UserSubmitDTO submitDTO) {
        return userQuestionService.rabbitSubmit(submitDTO);
    }

    @GetMapping("/exe/result")
    public  R<UserQuestionResultVO> exeResult(Long examId, Long questionId, String currentTime) {
        return userQuestionService.exeResult(examId, questionId, currentTime);
    }
}
